var app = new Vue({
    el: "#app",
    data: {
        user: {
            id: "",
            username: "",
            password: "",
            age: "",
            sex: "",
            email: ""
        },
        userList: []
    },
    methods: {
        findAll: function () {
            axios.get("/user/findAll")
                .then(function (response) {
                    app.userList = response.data;
                    console.log(response);
                })
        },

        findById: function (id) {

            axios.get("/user/findById?id="+id)
                .then(function (response) {
                app.user = response.data;
                $('#myModal').modal("show");
            }).catch(function (err) {
            });

        },

        update:function (user) {
            axios.post("/user/update",app.user)
                .then(function (response) {
                   app.findAll()

                })
        }



    },
created:function () {
    this.findAll()

}
});